#ifndef UNTITLED_FOREMOST_H
#define UNTITLED_FOREMOST_H
#include "graph.h"

class fADJ {
public:
    int source = 0;
    time_t start = 0, end = 0;
    int n = 0, m = 0;
    std::unordered_set<int> vertices;
    std::unordered_map<int, Edge> edges;
    std::unordered_map<int, std::set<Edge, EdgeOrderByOutTime>> out;
    std::unordered_map<int, std::set<Edge, EdgeOrderByInTime>> in;
    std::unordered_map<int, int> f;
    std::unordered_map<int, int> parent_edge;
    std::unordered_map<int, int> parent_node;
    std::unordered_map<int, std::unordered_set<int>> children;
    std::priority_queue<std::tuple<time_t, int, int, int>, std::vector<std::tuple<time_t, int, int ,int>>, std::greater<>> pq;
    std::unordered_set<int> red_set;
    fADJ(std::string filename);
    void caculate(int x, time_t ta, time_t to);
    void add_edges(std::vector<Edge> new_edges);
    void re_add_edges(std::vector<Edge> new_edges);
    void delete_edges(std::vector<Edge> old_edges);
    void re_delete_edges(std::vector<Edge> old_edges);
};

class fOSE {
public:
    int n = 0, m = 0;
    int source = 0;
    time_t start = 0, end = 0;
    std::unordered_set<int> vertices;
    std::set<Edge, EdgeOrderByOutTime> edges;
    std::unordered_map<int, int> f;
    std::unordered_map<int, int> parent_edge;
    std::unordered_map<int, int> parent_node;
    std::unordered_map<int, std::unordered_set<int>> children;
    void caculate(int x, time_t ta, time_t to);
    void add_edges(std::vector<Edge> new_edges);
    void delete_edges(std::vector<Edge> old_edges);
    fOSE(std::string filename);
};

void fstatic_test(std::string filename, int num);

void ffinal_add_test(std::string filename, int vnum, int mnum);

void ffinal_delete_test(std::string filename, int vnum, int mnum);
#endif //UNTITLED_FOREMOST_H
